package com.coocaa.ops.plus.core.third.magic.config;

import com.coocaa.ops.plus.core.third.magic.MagicFeignClient;
import com.coocaa.ops.common.tool.feign.FeignUtil;
import feign.codec.Encoder;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @author bjh
 * @description
 * @date 2020/12/22 20:06
 */
@Configuration
@Import(FeignClientsConfiguration.class)
public class MagicFeignConfig {
    private static final int CONNECT_TIMEOUT_MILLIS = 1000;

    private static final int READ_TIMEOUT_MILLIS = 30000;

    @Bean
    public MagicFeignClient magicFeignClient(Encoder encoder) {
        MagicFeignClient feignClient =
                FeignUtil.getFeignClient(encoder, MagicFeignClient.class, CONNECT_TIMEOUT_MILLIS, READ_TIMEOUT_MILLIS);
        return feignClient;
    }
}
